Skip to content

wasm-encoder: add ComponentBuilder::instantiate_exports - #2655

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
zacharywhitley:feat/component-instantiate-exports
Sep 15, 2026
Merged

alexcrichton merged 1 commit into
bytecodealliance:mainfrom
zacharywhitley:feat/component-instantiate-exports

Conversation

@zacharywhitley

@zacharywhitley zacharywhitley commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Adds ComponentBuilder::instantiate_exports as the component-level counterpart to the existing core_instantiate_exports, so callers can round-trip ComponentInstance::FromExports through the builder without dropping down to the raw section API.

@zacharywhitley
zacharywhitley requested a review from a team as a code owner September 12, 2026 12:16
@zacharywhitley
zacharywhitley requested review from dicej and removed request for a team September 12, 2026 12:16
@zacharywhitley
zacharywhitley force-pushed the feat/component-instantiate-exports branch from f66f04b to 5c4e5a8 Compare September 12, 2026 12:29
@alexcrichton

Copy link
Copy Markdown
Member

Thanks for the PR, and looks like a rustfmt is needed to get CI passing. Also please make sure to review our AI tool usage policy, for a change like this a small new function doesn't need such a large PR description

@alexcrichton
alexcrichton requested review from alexcrichton and removed request for dicej September 14, 2026 14:18
@zacharywhitley

Copy link
Copy Markdown
Contributor Author

Sorry about that. Damn things are a little too enthusiastic to post a PR before I can review it. I really wish they'd add something that would queue so it couldn't send them out before review. "Let me just go ahead and submit that PR.....beep bop-boop!" nooooo!!! :)

@cfallin

cfallin commented Sep 14, 2026

Copy link
Copy Markdown
Member

Sorry about that. Damn things are a little too enthusiastic to post a PR before I can review it. I really wish they'd add something that would queue so it couldn't send them out before review. "Let me just go ahead and submit that PR.....beep bop-boop!" nooooo!!! :)

FYI, just to make the point more explicit: automated posting of code that has not been reviewed by a human is even more against our policies than the lengthy LLM-generated description is. (In this case it's a trivial function, but the process is important here.)

I say this because your wording seems to imply somehow that this is not in your control ("I wish they'd add..."). I'd recommend either removing your bot's GitHub token or setting a hard blocker on creating PRs to Bytecode Alliance repos in whatever permissions system you have until you can work out why this slipped through. If we otherwise have an account that is posting AI-authored content, unreviewed by humans, with a human admitting they don't have full control of it, then this would have to go to the TSC for further action. Thanks!

@zacharywhitley

Copy link
Copy Markdown
Contributor Author

I appreciate that. I was just highlighting that it's far too easy to have happen and making a joke out of it

@zacharywhitley

Copy link
Copy Markdown
Contributor Author

On that note I think WebAssembly should be used more often for AI agent sanboxing. It could possibly have prevented the recent OpenAI/HF incident.

The core-level analogue `core_instantiate_exports` already exists on
`ComponentBuilder` and mirrors the `Instance::FromExports` variant of
the core instance section. The component-level side had no equivalent:
`ComponentInstanceSection::export_items` is public but only reachable
through the manual section-append path, not the builder facade.

Add `instantiate_exports` next to `instantiate` so callers rebuilding
a component structurally from a parsed one can round-trip
`ComponentInstance::FromExports` the same way core-level
`Instance::FromExports` already round-trips.

The signature follows the section-level `ComponentInstanceSection::
export_items` — `N: Into<ComponentExternName<'a>>` in the name slot,
preserving the rich name form (`implements` / `version_suffix` /
`external_id`) an item can carry. `&'a str` satisfies the bound via
the existing `From<&'a str> for ComponentExternName<'a>`, so callers
that only need a plain name write the same call as with
`core_instantiate_exports`.
@zacharywhitley
zacharywhitley force-pushed the feat/component-instantiate-exports branch from 0c84bd8 to 6881e52 Compare September 15, 2026 11:39
@zacharywhitley

Copy link
Copy Markdown
Contributor Author

Updated as requested.

@alexcrichton
alexcrichton added this pull request to the merge queue Sep 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 15, 2026
@alexcrichton
alexcrichton added this pull request to the merge queue Sep 15, 2026
Merged via the queue into bytecodealliance:main with commit 614c2ed Sep 15, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants